#ifndef __GLF_INPUTEVENT_H_INCLUDED__
#define __GLF_INPUTEVENT_H_INCLUDED__

#include <glf/config.h>
#include <glf/core/event.h>
#include <glf/math/vec3.h>
#include <glf/core/timer.h>
#include <glf/input/inputDevice.h>
#include <glf/input/inputEventType.h>

namespace glf 
{

	//InputEvent
	struct InputEvent : public CoreEvent {
	public:
		InputEvent(int eventType) : CoreEvent(eventType),
		  mInputDevice(0),
		  mTimeStamp(glf::GetMilliseconds())
		{
		}
	
	public:
		InputDevice *mInputDevice;
		//! time stamp
		int64 mTimeStamp;
	};

	//! Any kind of mouse event.
	struct MouseEvent : public InputEvent {
	public:
		MouseEvent(int eventType) : InputEvent(eventType),
			mBtn(Mouse::BTN_NONE),
			mWheel(0)
		{
		}

	public:
		//! Mouse btn which raises this event
		Mouse::Btn mBtn;
		//! Position of mouse cursor
		Point<short> mPos;
		//! Position of wheel cursor
		float mWheel;
	};

	//! Any kind of keyboard event.
	struct KeyboardEvent : public InputEvent {
	public:
		KeyboardEvent(int eventType) : InputEvent(eventType),
			mChar(0),
			mKey(Keyboard::KEY_NOKEY),
			mModifiers(Keyboard::MODIFIER_NOKEY)
		{
		}

	public:
		//! Character corresponding to the key (0, if not a character)
		wchar_t mChar;
		//! Key which has been pressed or released
		Keyboard::KeyCode mKey;			
		//! Combination of Keyboard::ModifierCode
		//! MODIFIER_CTRL | MODIFIER_ALT | MODIFIER_SHIFT
		int mModifiers;
	};

	struct GamepadConnectionEvent : public InputEvent {
		GamepadConnectionEvent(int eventType) : InputEvent(eventType)
			,	mIdx(-1)
			,	mConnected(false)
			
		{

		}
		int mIdx;
		bool mConnected;
	};


	//! Any kind of gamepad button event.
	struct GamepadButtonEvent : public InputEvent {
	public:
		GamepadButtonEvent(int eventType) : InputEvent(eventType),
			mBtnIndex(-1)
		{
		}

	public:
		int mBtnIndex;
	};

	//! Any kind of gamepad cursor event.
	struct GamepadCursorEvent : public InputEvent {
	public:
		GamepadCursorEvent(int eventType) : InputEvent(eventType),
			mCursorIndex(0)
		{
		}

	public:
		int mCursorIndex;
		Point<short> mPos;
	};

	//! Any kind of gamepad sensor event.
	struct GamepadSensorEvent : public InputEvent {
	public:
		GamepadSensorEvent(int eventType) : InputEvent(eventType),
			mSensorIndex(0),
			mValue(0.0f, 0.0f, 0.0f)
		{
		}

	public:
		int mSensorIndex;
		Vec3f mValue;		
	};

	//! Any kind of touchpad event.
	struct TouchPadEvent : public InputEvent {
	public:
		TouchPadEvent(int eventType) : InputEvent(eventType),
			mTouchPadIndex(0),
			mTouchId(0)
		{
		}

	public:
		int mTouchPadIndex;
		int mTouchId;
		Point<short> mPoint;		
	};

} //eon glf

#endif //__GLF_INPUTEVENT_H_INCLUDED__
